﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link href="~/Style/login/login.css" rel="stylesheet" />
    <link href="~/Style/layui/css/layui.css" rel="stylesheet" />
</head>
<body>



        <div style="padding: 20px; background-color: #F2F2F2; width: 200px;position: absolute;top: 60%;left: 55%;margin-left: -185px;margin-top: -276px;" display: inline-block;>
            <div class="layui-row layui-col-space15">
                <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username">
                            <input type="text"  id="usercode"  placeholder="用户名" class="layui-input">
                        </label>

                    </div>
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password">
                            <input type="password" id="password"  placeholder="密码" class="layui-input">

                        </label>
                    </div>
                    <div class="layui-form-item">
                        <button id="btnLogin" class="layui-btn layui-btn-normal layui-btn-fluid submit">登 入</button>
                    </div>
                </div>
            </div>


        </div>

    <script src="~/Style/js/jquery-3.4.1.min.js"></script>

<script src="~/Style/layui/layui.js"></script>

<script>
    layui.use('layer',function() {
        var layer = layui.layer;
        var sUrl = "/home/checklogin";
      
       
        $("#btnLogin").click(function() {
            $.ajax({
                url:sUrl,

                data: {
                    usercode: $("#usercode").val(),
                    password: $("#password").val()
                },

                type:"POST",
                async:true,
                success: function (retData){
                    if (retData.RetStatus == 100) {
                        layer.msg('登录成功');
                        var indexUrl = "/home/index?usercode=" + $("#usercode").val();
                        window.location.href = indexUrl;

                    } else if (retData.RetStatus != 100) {
                      
                        alert('用户名或密码错误');
                    }
                }
            });
    });
    });

        

    
   
</script>
</body>
</html>